<template>
  <dialog-editor ref="dialog"></dialog-editor>
</template>

<script>
import DialogEditor from '@/components/DialogEditor'
import dialogMixins from '@/utils/commonDialogMixins'

export default {
  mixins: [dialogMixins],
  components: {DialogEditor},
  data() {
    return {
      visible: false,

      dataFormConfig: {
        accountName: {
          label: '账号名称',
          placeholder: '请输入账号名称'
        },
        remark: {
          label: '备注',
          placeholder: '备注'
        },
        status: {
          label: '状态',
          type: 'switch',
          activeValue: 1,
          inactiveValue: 0,
          default: 1
        }
      }
    }
  },
  methods: {
    init(id) {
      this.dataForm.id = id || 0

      this.$refs.dialog.initDialog({
        dataForm: this.dataForm,
        config: this.dataFormConfig,
        dataRule: this.getNeedDataRule('accountName'),
        initApi: 'financeApi/getFinanceAccountInfoInfo',
        saveApi: 'financeApi/saveFinanceAccountInfo',
        updateApi: 'financeApi/updateFinanceAccountInfo',
        objectName: 'financeAccountInfo'
      })
    }
  }
}
</script>
